import axios from "axios";
var chart_6fe48f38dfde442f92c7ed78df54d00a = echarts.init(
    document.getElementById('6fe48f38dfde442f92c7ed78df54d00a'), 'white', { renderer: 'canvas' });
var option_6fe48f38dfde442f92c7ed78df54d00a = {
    "animation": true,
    "animationThreshold": 2000,
    "animationDuration": 1000,
    "animationEasing": "cubicOut",
    "animationDelay": 0,
    "animationDurationUpdate": 300,
    "animationEasingUpdate": "cubicOut",
    "animationDelayUpdate": 0,
    "color": [
        "#c23531",
        "#2f4554",
        "#61a0a8",
        "#d48265",
        "#749f83",
        "#ca8622",
        "#bda29a",
        "#6e7074",
        "#546570",
        "#c4ccd3",
        "#f05b72",
        "#ef5b9c",
        "#f47920",
        "#905a3d",
        "#fab27b",
        "#2a5caa",
        "#444693",
        "#726930",
        "#b2d235",
        "#6d8346",
        "#ac6767",
        "#1d953f",
        "#6950a1",
        "#918597"
    ],
    "series": [
        {
            "type": "bar",
            "legendHoverLink": true,
            "data": [
                50,
                39,
                27,
                21,
                18,
                15,
                9,
                8,
                8,
                7,
                6,
                6,
                4,
                4,
                4,
                4,
                3,
                3,
                3,
                3,
                3,
                3,
                2,
                2,
                2,
                2,
                2,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "showBackground": false,
            "barMinHeight": 0,
            "barCategoryGap": "40%",
            "barGap": "30%",
            "large": false,
            "largeThreshold": 400,
            "seriesLayoutBy": "column",
            "datasetIndex": 0,
            "clip": true,
            "zlevel": 0,
            "z": 2,
            "label": {
                "show": true,
                "position": "top",
                "color": "d4d4d4",
                "margin": 8
            },
            "itemStyle": {
                "normal": {
                    "color": new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(0, 244, 255, 1)' }, { offset: 1, color: 'rgba(0, 77, 167, 1)' }], false),
                    "barBorderRadius": [
                        30,
                        30,
                        30,
                        30
                    ]
                }
            },
            "rippleEffect": {
                "show": true,
                "brushType": "stroke",
                "scale": 2.5,
                "period": 4
            }
        }
    ],
    "legend": [
        {
            "data": [
                ""
            ],
            "selected": {
                "": true
            },
            "show": true,
            "padding": 5,
            "itemGap": 10,
            "itemWidth": 25,
            "itemHeight": 14
        }
    ],
    "tooltip": {
        "show": true,
        "trigger": "item",
        "triggerOn": "mousemove|click",
        "axisPointer": {
            "type": "line"
        },
        "showContent": true,
        "alwaysShowContent": false,
        "showDelay": 0,
        "hideDelay": 100,
        "textStyle": {
            "fontSize": 14
        },
        "borderWidth": 0,
        "padding": 5
    },
    "xAxis": [
        {
            "show": true,
            "scale": false,
            "nameLocation": "end",
            "nameGap": 15,
            "gridIndex": 0,
            "axisLine": {
                "show": false,
                "onZero": true,
                "onZeroAxisIndex": 0
            },
            "axisTick": {
                "show": false,
                "alignWithLabel": false,
                "inside": false
            },
            "axisLabel": {
                "show": true,
                "position": "top",
                "color": "#d4d4d4",
                "margin": 10
            },
            "inverse": false,
            "offset": 0,
            "splitNumber": 5,
            "minInterval": 0,
            "splitLine": {
                "show": false,
                "lineStyle": {
                    "show": true,
                    "width": 1,
                    "opacity": 1,
                    "curveness": 0,
                    "type": "solid"
                }
            },
            "data": [
                "\u5317\u4eac",
                "\u4e0a\u6d77",
                "\u6df1\u5733",
                "\u676d\u5dde",
                "\u5e7f\u5dde",
                "\u5357\u4eac",
                "\u53a6\u95e8",
                "\u5408\u80a5",
                "\u6210\u90fd",
                "\u6b66\u6c49",
                "\u798f\u5dde",
                "\u957f\u6c99",
                "\u897f\u5b89",
                "\u592a\u539f",
                "\u90d1\u5dde",
                "\u5929\u6d25",
                "\u5357\u5b81",
                "\u6d4e\u5357",
                "\u6c88\u9633",
                "\u4f5b\u5c71",
                "\u54c8\u5c14\u6ee8",
                "\u4e1c\u839e",
                "\u5927\u8fde",
                "\u547c\u548c\u6d69\u7279",
                "\u4e2d\u5c71",
                "\u6606\u660e",
                "\u82cf\u5dde",
                "\u4e34\u6c82",
                "\u54b8\u9633",
                "\u4fdd\u5b9a",
                "\u4e91\u6d6e",
                "\u5609\u5174",
                "\u535a\u5c14\u5854\u62c9\u8499\u53e4\u81ea\u6cbb\u5dde",
                "\u9a6c\u978d\u5c71",
                "\u5b81\u6ce2",
                "\u5b9c\u6625",
                "\u957f\u6625",
                "\u94f6\u5ddd",
                "\u91cd\u5e86",
                "\u8302\u540d",
                "\u829c\u6e56",
                "\u821f\u5c71",
                "\u77f3\u5bb6\u5e84",
                "\u6e56\u5dde",
                "\u6e05\u8fdc",
                "\u6dc4\u535a",
                "\u6c5f\u95e8",
                "\u65e0\u9521",
                "\u627f\u5fb7",
                "\u9752\u5c9b",
                "\u60e0\u5dde",
                "\u4e09\u4e9a"
            ]
        }
    ],
    "yAxis": [
        {
            "show": true,
            "scale": false,
            "nameLocation": "end",
            "nameGap": 15,
            "gridIndex": 0,
            "axisLine": {
                "show": false,
                "onZero": true,
                "onZeroAxisIndex": 0
            },
            "axisTick": {
                "show": false,
                "alignWithLabel": false,
                "inside": false
            },
            "axisLabel": {
                "show": false,
                "position": "top",
                "margin": 8
            },
            "inverse": false,
            "offset": 0,
            "splitNumber": 5,
            "minInterval": 0,
            "splitLine": {
                "show": false,
                "lineStyle": {
                    "show": true,
                    "width": 1,
                    "opacity": 1,
                    "curveness": 0,
                    "type": "solid"
                }
            }
        }
    ],
    "title": [
        {
            "text": "\u00b7\u804c\u4f4d\u5206\u5e03\u57ce\u5e02",
            "left": "center",
            "top": 5,
            "padding": 5,
            "itemGap": 10,
            "textStyle": {
                "color": "#d4d4d4",
                "fontWeight": "normal",
                "fontFamily": "\u534e\u6587\u7ec6\u9ed1",
                "fontSize": 18
            }
        }
    ],
    "dataZoom": {
        "show": true,
        "type": "slider",
        "realtime": true,
        "start": 0,
        "end": 25,
        "orient": "horizontal",
        "zoomLock": false,
        "filterMode": "filter"
    }
};
chart_6fe48f38dfde442f92c7ed78df54d00a.setOption(option_6fe48f38dfde442f92c7ed78df54d00a);
window.addEventListener('resize', function () {
    chart_6fe48f38dfde442f92c7ed78df54d00a.resize();
})
export const getDisCountBar = (city) => {
    axios
        .get(city + '/companyType')
        .then(function (response) {
            var names = []
            var values = []
            for(var itme of response.data){
                names.push(itme.name)
                values.push(itme.value)
            }
            option_6fe48f38dfde442f92c7ed78df54d00a.series[0].data = values
            option_6fe48f38dfde442f92c7ed78df54d00a.xAxis[0].data = names
            option_6fe48f38dfde442f92c7ed78df54d00a.dataZoom.end = 50
            option_6fe48f38dfde442f92c7ed78df54d00a.title[0].text = "公司行业"

            chart_6fe48f38dfde442f92c7ed78df54d00a.setOption(option_6fe48f38dfde442f92c7ed78df54d00a);
            window.addEventListener('resize', function () {
                chart_6fe48f38dfde442f92c7ed78df54d00a.resize();
            })
        })
        .catch(function (error) { // 请求失败处理
            console.log(error);
        })
}